import request from '../utils/request';

export async function findUsedMaterialRecord(body) {
  return request('/api/sales/material/used/find', {
    method: 'POST',
    body
  });
}
export async function create(body) {
  return request('/api/sales/create', {
    method: 'POST',
    body
  });
}
export async function findOne(body) {
  return request('/api/sales/find', {
    method: 'POST',
    body
  });
}

export async function findMany(body) {
  return request('/api/sales/find/many', {
    method: 'POST',
    body
  });
}

export async function updateOne(body) {
  return request('/api/sales/update', {
    method: 'POST',
    body
  });
}

export async function deleteOne(body) {
  return request('/api/sales/delete', {
    method: 'POST',
    body
  });
}

export async function review(body) {
  return request('/api/sales/review', {
    method: 'POST',
    body
  });
}

export async function payReview(body) {
  return request('/api/sales/pay/review', {
    method: 'POST',
    body
  });
}

export async function exportExcel(body) {
  return request('/api/sales/export', {
    method: 'POST',
    body
  });
}

export async function history(body) {
  return request('/api/sales/history/', {
    method: 'POST',
    body
  });
}

export async function uploadFile(body) {
  console.log('upload file', body);
  return request('/api/sales/upload/excel', {
    method: 'POST',
    body
  });
}

export async function findStatisticsMany(body) {
  return request('/api/sales/statistics/many', {
    method: 'POST',
    body
  });
}

export async function createRent(body) {
  return request('/api/sales/rent/create', {
    method: 'POST',
    body
  });
}
export async function updateRent(body) {
  return request('/api/sales/rent/update', {
    method: 'POST',
    body
  });
}
export async function deleteRent(body) {
  return request('/api/sales/rent/delete', {
    method: 'POST',
    body
  });
}
export async function findRent(body) {
  return request('/api/sales/rent/find', {
    method: 'POST',
    body
  });
}
export async function findRentMany(body) {
  return request('/api/sales/rent/find/many', {
    method: 'POST',
    body
  });
}

/**
 * 退补货
 */
// router.post('/api/sales/returnOfGoods/find/many', controller.sales.findReturnOrderMany);
// router.post('/api/sales/returnOfGoods/create', controller.sales.createReturnGoodsOrder);
// router.post('/api/sales/returnOfGoods/delete', controller.sales.deleteReturnGoodsOrder);
// router.post('/api/sales/returnOfGoods/update', controller.sales.updateReturnGoodsOrder);
//
// router.post('/api/sales/replenish/find/many', controller.sales.findReplenishRecordMany);
// router.post('/api/sales/replenish/create', controller.sales.createReplenishRecord);
// router.post('/api/sales/replenish/delete', controller.sales.deleteReplenishRecord);
// router.post('/api/sales/replenish/update', controller.sales.updateReplenishRecord);
export async function findReplenishRecordMany(body) {
  return request('/api/sales/replenish/find/many', {
    method: 'POST',
    body
  });
}
export async function createReplenishRecord(body) {
  return request('/api/sales/replenish/create', {
    method: 'POST',
    body
  });
}
export async function deleteReplenishRecord(body) {
  return request('/api/sales/replenish/delete', {
    method: 'POST',
    body
  });
}
export async function updateReplenishRecord(body) {
  return request('/api/sales/replenish/update', {
    method: 'POST',
    body
  });
}

export async function findReturnOrderMany(body) {
  return request('/api/sales/returnOfGoods/find/many', {
    method: 'POST',
    body
  });
}
export async function createReturnGoodsOrder(body) {
  return request('/api/sales/returnOfGoods/create', {
    method: 'POST',
    body
  });
}
export async function deleteReturnGoodsOrder(body) {
  return request('/api/sales/returnOfGoods/delete', {
    method: 'POST',
    body
  });
}
export async function updateReturnGoodsOrder(body) {
  return request('/api/sales/returnOfGoods/update', {
    method: 'POST',
    body
  });
}
export async function findSalesProdMany(body) {
  return request('/api/sales/prod/find/many', {
    method: 'POST',
    body
  });
}
